Page({
  data: {
   cateItems: [
     {
       cate_id: 0,
       cate_name: "新鲜水果",
       ishaveChild: true,//判断是否有子菜单
       children:
       [
         {
           child_id: 1,
           name: '子菜单',
           url:'details/index',
           image: "http://img95.699pic.com/photo/40008/7712.jpg_wh300.jpg"
         },
         {
           child_id: 2,
           name: '子菜单',
           url:'details/index',
           image: "http://img95.699pic.com/photo/40008/7712.jpg_wh300.jpg"
         },
         {
           child_id: 3,
           name: '子菜单',
           url:'details/index',
           image: "http://img95.699pic.com/photo/40008/7712.jpg_wh300.jpg"
         }
       ]
     },
     {
       cate_id: 1,
       cate_name: "海鲜水产",
       ishaveChild: true,
       children:
       [
         {
           child_id: 1,
           name: '海鲜水产',
           url:'details/index',
           image: "http://demo.demohuo.top/modals/64/6496/demo/images/26.png"
         }
       ]
     },
     {
       cate_id: 2,
       cate_name: "时令鲜蔬",
       ishaveChild: true,
       children:
       [
         {
           child_id: 1,
           name: '时令鲜蔬',
           url:'details/index',
           image: "http://demo.demohuo.top/modals/64/6496/demo/images/28.png"
         }
       ]
     },
     {
       cate_id: 3,
       cate_name: "精选肉禽",
       ishaveChild: true,
       children: [
          {
            child_id: 1,
            name: '精选肉禽',
            url:'details/index',
            image: "http://demo.demohuo.top/modals/64/6496/demo/images/27.png"
          }
        ]
     },
     {
       cate_id: 4,
       cate_name: "牛奶乳品",
       ishaveChild: true,
       children: [
        {
          child_id: 1,
          name: '牛奶乳品',
          url:'details/index',
          image: "http://demo.demohuo.top/modals/64/6496/demo/images/25.png"
        }
       ]
     },
     {
       cate_id: 5,
       cate_name: "粮油副食",
       ishaveChild: true,
       children: [
          {
            child_id: 1,
            name: '粮油副食',
            url:'details/index',
            image: "http://demo.demohuo.top/modals/64/6496/demo/images/24.png"
          }
        ]
     },
     {
       cate_id: 6,
       cate_name: "休闲零食",
       ishaveChild: true,
       children: [
          {
            child_id: 1,
            name: '休闲零食',
            url:'details/index',
            image: "http://demo.demohuo.top/modals/64/6496/demo/images/23.png"
          }
       ]
     },
     {
       cate_id: 7,
       cate_name: "酒水饮料",
       ishaveChild: true,
       children: [
          {
            child_id: 1,
            name: '酒水饮料',
            url:'details/index',
            image: "http://demo.demohuo.top/modals/64/6496/demo/images/22.png"
          }
       ]
     }
   ],
   curNav: 1,
   curIndex: 0
  },
  
  //事件处理函数  
  switchRightTab: function (e) {
   // 获取item项的id，和数组的下标值  
   let id = e.target.dataset.id,
     index = parseInt(e.target.dataset.index);
   // 把点击到的某一项，设为当前index  
   this.setData({
     curNav: id,
     curIndex: index
   })
  }
  })